package com.webserver.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.alibaba.druid.pool.DruidDataSource;

public class DBUtil {
    private static DruidDataSource dds = null;
    static {
        dds = new DruidDataSource();
        dds.setUsername("root");
        dds.setPassword("root");
        dds.setUrl("jdbc:mysql://localhost:3306/tedu?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true");
        dds.setInitialSize(3);
        dds.setMaxActive(5);
    }

    public static Connection getConn() throws SQLException {
        return dds.getConnection();
    }
}
